home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / snip1292.zip / MOUSE.C < prev    next >
C/C++ Source or Header  |  1992-12-26  |  1KB  |  86 lines

  1. /*      module:         mouse.c
  2.  *      programmer:     Ray L. McVay
  3.  *      started:        26oct86
  4.  *      updated:        26oct86
  5.  *
  6.  *      Some handy mouse interface functions.
  7.  */
  8.  
  9. #include <stdio.h>
  10. #include <dos.h>
  11.  
  12. static union REGS reg;
  13. static struct SREGS sreg;
  14.  
  15.  
  16. int mstatus(void)
  17. {
  18.       reg.x.ax = 0;
  19.       int86(0x33, ®, ®);
  20.       if (reg.x.ax == 0xffff)
  21.             return(reg.x.bx);
  22.       else  return(0);
  23. }
  24.  
  25.  
  26. void mshow(void)
  27. {
  28.       reg.x.ax = 1;
  29.       int86(0x33, ®, ®);
  30. }
  31.  
  32.  
  33. void mhide(void)
  34. {
  35.       reg.x.ax = 2;
  36.       int86(0x33, ®, ®);
  37. }
  38.  
  39.  
  40. void mpos(int *mbt, int *mx, int *my)
  41. {
  42.       reg.x.ax = 3;
  43.       int86(0x33, ®, ®);
  44.       *mbt = reg.x.bx;
  45.       *mx = reg.x.cx;
  46.       *my = reg.x.dx;
  47. }
  48.  
  49.  
  50. void mput(int mx, int my)
  51. {
  52.       reg.x.ax = 4;
  53.       reg.x.cx = mx;
  54.       reg.x.dx = my;
  55.       int86(0x33, ®, ®);
  56. }
  57.  
  58.  
  59. void mhlimit(int hmin, int hmax)
  60. {
  61.       reg.x.ax = 7;
  62.       reg.x.cx = hmin;
  63.       reg.x.dx = hmax;
  64.       int86(0x33, ®, ®);
  65. }
  66.  
  67.  
  68. void mvlimit(int vmin, int vmax)
  69. {
  70.       reg.x.ax = 8;
  71.       reg.x.cx = vmin;
  72.       reg.x.dx = vmax;
  73.       int86(0x33, ®, ®);
  74. }
  75.  
  76.  
  77. void mshape(int xhot, int yhot, int far shape[]) /* shape[32] */
  78. {
  79.       reg.x.ax = 9;
  80.       reg.x.bx = xhot;
  81.       reg.x.cx = yhot;
  82.       reg.x.dx = FP_OFF(shape);
  83.       sreg.es = FP_SEG(shape);
  84.       int86x(0x33, ®, ®, &sreg);
  85. }
  86.